﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FrameWork.Components;
using System.Collections;
using FrameWork.WebControls;

namespace FrameWork.web.Module.IntegralMS.IntegralMS.ClassManager
{
    public partial class GroupList : System.Web.UI.Page
    {
        int ClassID;
        protected void Page_Load(object sender, EventArgs e)
        {
            ClassID = (int)Common.sink("ClassID", MethodType.Get, 255, 0, DataType.Int);
            if (!IsPostBack)
            {
                OnStart();
                ButtonBind();
            }
        }
        private void OnStart()
        {
            int RecordCount = 0;
            QueryParam qp = new QueryParam();
            qp.Orderfld = "C_Level,C_ShowOrder";
            qp.OrderType = 0;
            qp.Where = string.Format("Where C_ParentID ={0} and C_Delete=0 ", ClassID);
            ArrayList lst = BusinessFacade.stu_ClassInfoList(qp, out RecordCount);

            CatCountTxt.Text = RecordCount.ToString();
            if (ClassID == 0)
                CatNameTxt.Text = "技术方向列表";
            else
            {
                CatNameTxt.Text = BusinessFacade.stu_ClassInfoDisp(ClassID).C_CName;
            }
            SubGroup.DataSource = lst;
            SubGroup.DataBind();
            CatListTitle.Text = string.Format("<a href='GroupList.aspx'>技术方向列表</a>{0}", BusinessFacade.GetClassInfoTitle(ClassID));
        }
        private void ButtonBind()
        {
            HeadMenuButtonItem bi0 = new HeadMenuButtonItem();
            bi0.ButtonPopedom = PopedomType.New;
            bi0.ButtonName = "班级";
            bi0.ButtonUrl = string.Format("New.aspx?ClassID={0}", ClassID);
            HeadMenuWebControls1.ButtonList.Add(bi0);
            if (ClassID != 0)
            {
                HeadMenuButtonItem bi2 = new HeadMenuButtonItem();
                bi2.ButtonPopedom = PopedomType.Edit;
                bi2.ButtonName = "班级";
                bi2.ButtonUrl = string.Format("Edit.aspx?ClassID={0}", ClassID);
                HeadMenuWebControls1.ButtonList.Add(bi2);
                
            }
        }
    }
}